(global.webpackJsonp = global.webpackJsonp || []).push([
  ["wjyk_recycle/pages/become-recycler/become-recycler"], {
    "0d6c": function (t, e, n) {
      var o = n("6ac4");
      n.n(o).a;
    },
    "3e6a": function (t, e, n) {
      (function (t) {
        function e(t) {
          return t && t.__esModule ? t : {
            default: t
          };
        }
        n("8163"), e(n("66fd")), t(e(n("a534")).default);
      }).call(this, n("543d").createPage);
    },
    "6ac4": function (t, e, n) {},
    "894b": function (t, e, n) {
      n.r(e);
      var o, a = n("d34c"),
        r = n.n(a);
      for (o in a) "default" !== o && function (t) {
        n.d(e, t, function () {
          return a[t];
        });
      }(o);
      e.default = r.a;
    },
    a534: function (t, e, n) {
      n.r(e);
      var o, a = n("e9a3"),
        r = n("894b");
      for (o in r) "default" !== o && function (t) {
        n.d(e, t, function () {
          return r[t];
        });
      }(o);
      n("0d6c");
      var c = n("f0c5"),
        a = Object(c.a)(r.default, a.b, a.c, !1, null, null, null, !1, a.a, void 0);
      e.default = a.exports;
    },
    d34c: function (t, n, o) {
      (function (a) {
        Object.defineProperty(n, "__esModule", {
          value: !0
        }), n.default = void 0;
        var t, r = (t = o("4795")) && t.__esModule ? t : {
          default: t
        };

        function i(t, e, n, o, a, r, c) {
          try {
            var s = t[r](c),
              i = s.value;
          } catch (t) {
            return n(t), 0;
          }
          s.done ? e(i) : Promise.resolve(i).then(o, a);
        }

        function c(s) {
          return function () {
            var t = this,
              c = arguments;
            return new Promise(function (e, n) {
              var o = s.apply(t, c);

              function a(t) {
                i(o, e, n, a, r, "next", t);
              }

              function r(t) {
                i(o, e, n, a, r, "throw", t);
              }
              a(void 0);
            });
          };
        }
        var e = {
          data: function () {
            return {
              pic_url: this.$imgUrl,
              system: {},
              collectorSystem: {},
              name: "",
              telphone: "",
              input_code: "",
              code: "",
              title: "获取验证码",
              timer: 60,
              disabled: !1,
              protocolRichText: "",
              flag: 0,
              regularFlag: 0,
              agreeFlag: 0,
              is_open: null,
              region: ["", "", ""],
              province: "",
              city: "",
              county: "",
              tempId: "",
              idnumber: "",
              obj: {
                pic_url: "",
                pic_back_url: "",
                shenfen_code: "",
              },
            };
          },
          onLoad: function () {
            this.systems(), this.collectorSet(), this.changeFlag(1, "single");
          },
          methods: {
            getImageInfo: function (t) {
              console.log(t), this.obj.pic_url = "";
              for (var e = 0; e < t.length; e++) {
                if (e == t.length - 1) return void(this.obj.pic_url += t[e]);
                this.obj.pic_url += t[e] + ",";
              }
            },
            getImageInfo1: function (t) {
              console.log(t), this.obj.pic_back_url = "";
              for (var e = 0; e < t.length; e++) {
                if (e == t.length - 1) return void(this.obj.pic_back_url += t[e]);
                this.obj.pic_back_url += t[e] + ",";
              }
            },
            close: function () {
              this.$refs.pop.close();
            },
            openProtocol: function () {
              this.$refs.pop.show({
                title: this.collectorSystem.protocol_name,
                content: "<div>&nbsp;</div>",
                style: "background-color:#fff;width:600rpx;border-radius:10rpx;",
                xclose: !0
              });
            },
            changeFlag: function (t, e) {
              console.log("选择性别", t, e), "single" == e ? (this.flag = t, this.regularFlag = 0) : (this.regularFlag = t,
                this.flag = 0);
            },
            isAgree: function (t) {
              this.agreeFlag = t;
            },
            bindPickerChange: function (t) {
              console.log("picker发送选择改变，携带值为", t, t.target.value), this.region[0] = t.target.value[0],
                this.region[1] = t.target.value[1], this.region[2] = t.target.value[2], this.province = t.target.value[0],
                this.city = t.target.value[1], this.county = t.target.value[2];
            },
            systems: function () {
              var n = this;
              return c(r.default.mark(function t() {
                var e;
                return r.default.wrap(function (t) {
                  for (;;) switch (t.prev = t.next) {
                    case 0:
                      return t.next = 2, n.$http({
                        url: n.$api.system
                      });

                    case 2:
                      0 == (e = t.sent).errno && (console.log("系统设置", e), n.tempId = e.data.userTemplate,
                        n.is_open = e.data.is_open, n.system = e.data);

                    case 4:
                    case "end":
                      return t.stop();
                  }
                }, t);
              }))();
            },
            collectorSet: function () {
              var n = this;
              return c(r.default.mark(function t() {
                var e;
                return r.default.wrap(function (t) {
                  for (;;) switch (t.prev = t.next) {
                    case 0:
                      return t.next = 2, n.$http({
                        url: n.$api.collectorSet
                      });

                    case 2:
                      0 == (e = t.sent).errno && (console.log("回收员设置", e), n.protocolRichText = e.data.protocol,
                        n.collectorSystem = e.data);

                    case 4:
                    case "end":
                      return t.stop();
                  }
                }, t);
              }))();
            },
            becomeRecycler: function () {
              console.info('becomeRecyclerbecomeRecyclerbecomeRecycler')
              return console.info("----------", this.flag, this.regularFlag, this.agreeFlag), this.name ? 0 == this.flag && 0 == this.regularFlag ? (this.showToast("请选择性别"),
                !1) : this.telphone ? /^1[3456789]\d{9}$/.test(this.telphone) ? this.input_code || 1 != this.is_open ? this.input_code != this.code && 1 == this.is_open ? (this.showToast("验证码错误"),
                // !1) : this.idnumber ? (this.showToast("身份证号不能为空"),
                !1) : this.province ? 0 == this.agreeFlag ? (this.showToast("请勾选" + this.collectorSystem.protocol_name),
                !1) : (this.collectorJudgeCollector(), void console.log("提交成功")) : (this.showToast("请选择申请地区"),
                !1) : (this.showToast("请输入验证码"), !1) : (this.showToast("请输入正确的手机号码"), !1) : (this.showToast("手机号码不能为空"),
                !1) : (this.showToast("姓名不能为空"), !1);
                // !1) : (this.showToast("身份证不能为空"), !1)
            },
            wxPay: function () {
              var o = this;
              return c(r.default.mark(function t() {
                var n;
                return r.default.wrap(function (t) {
                  for (;;) switch (t.prev = t.next) {
                    case 0:
                      return t.next = 2, o.$http({
                        url: o.$api.pay,
                        show: !0,
                        method: "post",
                        data: {
                          openid: a.getStorageSync("openid"),
                          money: o.collectorSystem.money
                        }
                      });

                    case 2:
                      n = t.sent, console.log("微信支付", n), 0 == n.errno && a.requestPayment({
                        provider: "wxpay",
                        timeStamp: n.data.timeStamp,
                        nonceStr: n.data.nonceStr,
                        package: n.data.package,
                        signType: n.data.signType,
                        paySign: n.data.paySign,
                        out_trade_no: n.data.out_trade_no,
                        success: function () {
                          var e = c(r.default.mark(function t(e) {
                            return r.default.wrap(function (t) {
                              for (;;) switch (t.prev = t.next) {
                                case 0:
                                  o.collectorRegister(n.data.out_trade_no);

                                case 1:
                                case "end":
                                  return t.stop();
                              }
                            }, t);
                          }));
                          return function (t) {
                            return e.apply(this, arguments);
                          };
                        }(),
                        fail: function (t) {
                          console.log(JSON.stringify(t)), o.$sun.toast("取消支付");
                        }
                      });

                    case 5:
                    case "end":
                      return t.stop();
                  }
                }, t);
              }))();
            },
            collectorRegister: function (n) {
              console.info('lllllllllllllllll')
              var o = this;
              return c(r.default.mark(function t() {
                var e;
                return r.default.wrap(function (t) {
                  console.info(t.next,'55555555555555555555')
                  for (;;) switch (t.prev = t.next) {
                    case 0:
                      console.info(o.$api.collectorRegister,'nnnnnnnnnnnnnnnnnnn')
                      e = 0 == o.flag ? 2 : 1, console.log("性别", e), o.$http({
                        url: o.$api.collectorRegister,
                        data: {
                          logno: n,
                          uid: a.getStorageSync("uid"),
                          name: o.name,
                          sex: e,
                          telphone: o.telphone,
                          money: o.collectorSystem.money,
                          province: o.province,
                          city: o.city,
                          county: o.county,
                          shenfen_z: o.obj.pic_url,
                          shenfen_f: o.obj.pic_back_url,
                          shenfen_code: o.idnumber,
                        }
                      }).then(function (t) {
                        o.acceptMessage();
                      }).catch(function (t) {
                        console.log("**************", t), o.$sun.toast(t.data.message);
                      });

                    case 3:
                    case "end":
                      return t.stop();
                  }
                }, t);
              }))();
            },
            acceptMessage: function () {
              var n = this;
              wx.getSetting({
                withSubscriptions: !0,
                success: function (t) {
                  var e;
                  console.log(t.subscriptionsSetting), 0 == t.subscriptionsSetting.mainSwitch ? a.navigateTo({
                    url: "../apply-settle/apply-settle?name=recycler"
                  }) : (console.log("订阅消息", n.tempId), a.requestSubscribeMessage({
                    tmplIds: [n.tempId],
                    success: (e = c(r.default.mark(function t(e) {
                      return r.default.wrap(function (t) {
                        for (;;) switch (t.prev = t.next) {
                          case 0:
                            console.log("data", e, n.tempId, [n.tempId]), "accept" == e[n.tempId] ? (console.log("授权成功", e),
                              a.navigateTo({
                                url: "../apply-settle/apply-settle?name=recycler"
                              })) : wx.showModal({
                              title: "温馨提示",
                              content: "您已拒绝授权，将无法在微信中收到通知！",
                              showCancel: !1,
                              success: function (t) {
                                t.confirm && console.log("拒绝授权", e);
                              }
                            });

                          case 2:
                          case "end":
                            return t.stop();
                        }
                      }, t);
                    })), function (t) {
                      return e.apply(this, arguments);
                    }),
                    fail: function (t) {
                      console.log("失败", t);
                    },
                    complete: function (t) {
                      console.log("完成", t);
                    }
                  }));
                }
              });
            },
            collectorJudgeCollector: function () {
              console.info(this.idnumber,'this.idnumber')
              if(this.idnumber == ''){
                this.showToast("请输入身份证号")
                return false
              }
              // obj: {
              //   pic_url: "",
              //   pic_back_url: "",
              //   shenfen_code: "",
              // },
              if(this.obj.pic_url == ''){
                this.showToast("请上传身份证正面照")
                return false
              }
              if(this.obj.pic_back_url == ''){
                this.showToast("请上传身份证反面照")
                return false
              }
              
              var e = this;
              return c(r.default.mark(function t() {
                return r.default.wrap(function (t) {
                  for (;;) switch (t.prev = t.next) {
                    case 0:
                      e.$http({
                        url: e.$api.collectorJudgeCollector,
                        data: {
                          province: e.province,
                          city: e.city,
                          county: e.county
                        }
                      }).then(function (t) {
                        console.info(e.collectorSystem.money,'/////////////////////')
                        0 < e.collectorSystem.money ? e.wxPay() : e.collectorRegister(0);
                        wx.navigateTo({
                          url: "../apply-settle/apply-settle?name=partner"
                        });
                      }).catch(function (t) {
                        e.$sun.toast(t.data.message);
                      });

                    case 1:
                    case "end":
                      return t.stop();
                  }
                }, t);
              }))();
            },
            showToast: function (t) {
              a.showToast({
                title: t,
                duration: 1e3,
                icon: "none"
              });
            },
            getCode: function () {
              var t = this;
              console.log("++++++++", this.telphone);
              var e = !0;
              if (this.disabled) console.log("重复点击");
              else {
                if (!/^1[3456789]\d{9}$/.test(this.telphone)) return void wx.showToast({
                  title: "请输入正确的手机号码",
                  icon: "none"
                });
                this.disabled = !0;
                var n = setInterval(function () {
                  if (t.timer--, t.title = t.timer + "s后重新发送", 0 == t.timer) return clearInterval(n),
                    t.title = "获取验证码", t.disabled = !1, void(t.timer = 60);
                }, 1e3);
              }
              e && this.sendMobile();
            },
            sendMobile: function () {
              var n = this;
              return c(r.default.mark(function t() {
                var e;
                return r.default.wrap(function (t) {
                  for (;;) switch (t.prev = t.next) {
                    case 0:
                      return t.next = 2, n.$http({
                        url: n.$api.sendMobile,
                        data: {
                          telphone: n.telphone
                        }
                      });

                    case 2:
                      e = t.sent, console.log("发送验证码成功", e), 0 == e.errno && (console.log("验证码", e, e.data),
                        n.code = e.data);

                    case 5:
                    case "end":
                      return t.stop();
                  }
                }, t);
              }))();
            }
          }
        };
        n.default = e;
      }).call(this, o("543d").default);
    },
    e9a3: function (t, e, n) {
      function o() {
        this.$createElement, this._self._c;
      }
      var a = {
          sunuiPopup: function () {
            return n.e("components/sunui-popup/sunui-popup").then(n.bind(null, "c2fe"));
          }
        },
        r = [];
      n.d(e, "b", function () {
        return o;
      }), n.d(e, "c", function () {
        return r;
      }), n.d(e, "a", function () {
        return a;
      });
    }
  },
  [
    ["3e6a", "common/runtime", "common/vendor"]
  ]
]);